<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\widgets\ListView;
use app\models\Type;
use app\models\Auction;
use app\models\Product;


/* @var $this yii\web\View */
/* @var $model app\models\Auction */
/* @var $picDataProvider yii\data\ActiveDataProvider */

$this->title = $model->product->name;
$this->params['breadcrumbs'][] = ['label' => '竞拍', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <div class="wrapper wrapper-content  animated fadeInRight blog">
    <div class="page-content">
        <div class="panel panel-default">
            <div class="panel-heading"><?= Html::encode("图片") ?> </div>
            <div class="panel-body">
            <?= ListView::widget([
                'dataProvider'=>$picDataProvider,
                'itemView' => '_pic',
            ]);?>
            </div>
        </div>
    </div>
    </div>
    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'auctionid',
            [
                'attribute' => 'product.type_id',
                'value'=>Type::dropdown('type',$model->product->type_id)
            ],
            'periods',
            'product.name',
            'product.hot',
            'market_val',
            'cost',
            'return_rate',
            'start_price',
            'scope',
            'fee',
            'degree',
            'lowest_price',
            'highest_price',
            'default_price',
            'actcount',
            'reacount',
            'price',
            [
                'attribute' => 'can_robot',
                'value'=>Auction::dropdown('can_robot',$model->can_robot),
            ],
            [
                'attribute' => 'have_cost',
                'value'=>Auction::dropdown('have_cost',$model->have_cost),
            ],
            [
                'attribute' => 'ios',
                'value'=>Product::dropdown('ios',$model->product->ios),
            ],
            [
                'attribute' => 'can_give',
                'value'=>Auction::dropdown('can_give',$model->can_give),
            ],
            [
                'attribute' => 'product.kind',
                'value'=>Product::dropdown('kind',$model->product->kind),
            ],
            [
                'attribute' => 'state',
                'value'=>Auction::dropdown('state',$model->state),
            ],
            [
                'attribute' => 'created_at',
                'format' => ['date', 'php:Y-m-d']
            ],
            [
                'attribute' => 'updated_at',
                'format' => ['date', 'php:Y-m-d']
            ],
        ],
    ]) ?>

</div>
<?php $this->beginBlock('css')?>
<?=Html::cssFile('@hplus/css/style.min.css')?>
<?=Html::cssFile('@hplus/css/font-awesome.min.css?v=4.4.0')?>
<?php $this->endBlock();?>
<?php $this->beginBlock('js')?>
<?php if($model->state == Auction::STATE_IS_AUCTION):?>
    <script>setTimeout("location.reload(); ", 5000); </script>
<?php endif;?>
<?php $this->endBlock();?>
